{% extends "StartGroup/groupHome.html" %}
{% block extrajs %}
{% endblock %}
{% block portraitUpload %}{% endblock %}

{% block content %}
    <script src="/{{ media_url }}contifyuser/js/jquery-1.4.2.min.js" type="text/javascript"></script>
    <script type='text/javascript'>
	    $(document).ready(function(){
		info_head =  $('#h_ih').html();
		info =  $('#h_i').html();
		contact_info =  $('#h_ci').html();
		locations_info =  $('#h_li').html();
		
		// Assign default header information if exists
		if (info_head){
		    $('#id_info_head').html(info_head);
		}
		
		// Assign default info if exists
		if (info){
		    $('#id_info').val(info);
		}
		
		// Assign default contact info if exists
		if (contact_info){
		     $('#id_contact_info').val(contact_info);
		}
		
		// Assign default locations info if exists
		if (locations_info){		   
		    $('#id_locations_info').val(locations_info);
		}
	    });
    </script>
    {% if permission == "Owner" or permission == "Board Member" %}
    <!-- Take hidden values of information form -->
    <div style="display:none;" id="h_ih">{{ information.info_head }}</div>
    <div style="display:none;" id="h_i">{{ information.info }}</div>
    <div style="display:none;" id="h_ci">{{ information.contact_info }}</div>
    <div style="display:none;" id="h_li">{{ information.locations_info }}</div>
    <div id="startGroupDivId" class="startForm">
	<form method="POST" id="start_group" action="/connectpeople/{{ group.group_web_address }}/groupinfo/save">	
	<div class="groupInfoContainer">
	    <div class="nobreak">
		<div class="nobreak infoFormFieldLine">
		    <div class="nobreak infoFormLabel"><span><strong>{{ group_info_form.info_head.label_tag }}</strong></span></div>
		    <div class="nobreak infoFormField">{{ group_info_form.info_head }}</div>
		</div>		
	    </div>
	    <div class="nobreak clearbreak">
		<div class="nobreak infoFormFieldLine">
		    <div class="nobreak infoFormLabel"><span><strong>{{ group_info_form.info.label_tag }}</strong></span></div>
		    <div class="nobreak infoFormField">{{ group_info_form.info }}</div>
		</div>
	    </div>
	    <div class="nobreak clearbreak">
		<div class="nobreak infoFormFieldLeft">
		    <div class="nobreak infoFormLabel"><span><strong>{{ group_info_form.contact_info.label_tag }}</strong></span></div>
		    <div class="nobreak clearbreak">{{ group_info_form.contact_info }}</div>
		</div>
		<div class="nobreak infoFormFieldLeft">
		    <div class="nobreak infoFormLabel"><span><strong>{{ group_info_form.locations_info.label_tag }}</strong></span></div>
		    <div class="nobreak clearbreak">{{ group_info_form.locations_info }}</div>
		</div>
	    </div>
	    <div class="nobreak clearbreak">
		<input type="submit" value="Update Information"  name='registerGroup'/>
	    </div>
	</div>
    	</form>
    </div>
    {% else %}
	<div class="groupInfoContainer">
		Only Owner and Board Members can update the information.
	</div>
    {% endif %}
{% endblock %}
